﻿#region Imports

using System.Collections.Generic;
using System.Linq;
using BrainTechLLC;

#endregion

namespace MammothMicro.SilverSocket.Shared
{
    /// <summary>
    /// The default message compressor.
    /// </summary>
    public class DefaultMessageCompressor : IMessageCompressor
    {
        #region IMessageCompressor Members

        /// <summary>
        /// The compress.
        /// </summary>
        /// <param name="stream">
        /// The stream.
        /// </param>
        /// <returns>
        /// </returns>
        public List<byte> Compress(List<byte> stream)
        {
            return MiniLZO.Compress(stream.ToArray()).ToList();
        }

        /// <summary>
        /// The decompress.
        /// </summary>
        /// <param name="stream">
        /// The stream.
        /// </param>
        /// <returns>
        /// </returns>
        public List<byte> Decompress(List<byte> stream)
        {
            return MiniLZO.Decompress(stream.ToArray()).ToList();
        }

        #endregion
    }
}